//
//  CustomCell.m
//  Scope
//
//  Created by lanou3g on 15/7/14.
//  Copyright (c) 2015年 崔鹏飞. All rights reserved.
//

#import "CustomCell.h"
#import "Header.h"
#import "CategoryVideo.h"

@implementation CustomCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.categoryImageView];
    }
    return self;
}

- (UIImageView *)categoryImageView
{
    if (!_categoryImageView) {
        self.categoryImageView = [[UIImageView alloc] initWithFrame:self.bounds];
        [_categoryImageView addSubview:self.titleLabel];
    }
    return _categoryImageView;
}

- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_categoryImageView.width / 2 - 20, _categoryImageView.height / 2 - 20, 50, 40)];
        _titleLabel.textColor = [UIColor whiteColor];
        [_titleLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:16]];
    }
    return _titleLabel;
}

- (void)setCategoryVideo:(CategoryVideo *)categoryVideo
{
    [self.categoryImageView setImageWithURL:[NSURL URLWithString:categoryVideo.bgPicture]];
    self.titleLabel.text = [NSString stringWithFormat:@"#%@",categoryVideo.name];
}

@end
